package com.whisperarts.financer.model.transaction;

import java.util.ArrayList;
import java.util.List;

public class Category {
	private int id;
	private String name;
	private boolean income;
	private int parentId;
	private final List<Category> sub = new ArrayList<Category>();	
	
	public Category () {
	}

	public Category (int id, String name, boolean income, int parentId) {
		this.id = id;
		this.name = name;
		this.income = income;
		this.parentId = parentId;
	}
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public boolean isIncome() {
		return income;
	}
	public void setIncome(boolean income) {
		this.income = income;
	}
	public int getParentId() {
		return parentId;
	}
	public void setParentId(int parentId) {
		this.parentId = parentId;
	}
	public List<Category> getSub() {
		return sub;	
	}
	public void addSub(Category category) {
		sub.add(category);
	}
	public boolean hasSub() {
		return sub.size() != 0;
	}
	
	@Override
	public String toString() {
		return name;
	}
}
